//
//  HBHMainGetMoreNoImageView.m
//  HubeiHotel
//
//  Created by 张露杰 on 17/11/14.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "HBHMainGetMoreNoImageView.h"

typedef void(^HBHMainGetMoreNoImageViewBlock)(NSInteger);

@implementation HBHMainGetMoreNoImageView
{
    HBHMainGetMoreNoImageViewBlock _complete;
}
- (instancetype)initWithFrame:(CGRect)frame complete:(void (^)(NSInteger))complete{
    self = [super initWithFrame:frame];
    if (self) {
        self.frame = CGRectMake(frame.origin.x, frame.origin.y, 180*screenW_6, 172.5*screenW_6);
        self.backgroundColor = [UIColor whiteColor];
        
        if (complete) {
            _complete = complete;
        }
        
        UIImageView *titleImageV = [TomamaUI createImageView:CGRectMake(14*screenW_6, 13*screenW_6, 72*screenW_6, 13.5*screenW_6) backGroundImageV:@"Main_meili"];
        [self addSubview:titleImageV];
        
        UILabel *label = [TomamaUI createLabel:CGRectMake(14*screenW_6, CGRectGetMaxY(titleImageV.frame) + 7*screenW_6, self.frame.size.width - 28*screenW_6, 11*screenW_6) textAligment:0 font:[UIFont systemFontOfSize:11*screenW_6] textColor:TextBlack text:@"孤勇之后，世界就在眼前"];
        [self addSubview:label];
        
        UILabel *moreLabel = [TomamaUI createLabel:CGRectMake(14*screenW_6, CGRectGetMaxY(label.frame) + 13*screenW_6, 50*screenW_6, 17*screenW_6) textAligment:1 font:[UIFont systemFontOfSize:10*screenW_6] textColor:[UIColor colorWithHexString:@"#e8cead"] text:@"查看更多"];
        [self addSubview:moreLabel];
        moreLabel.layer.masksToBounds = YES;
        moreLabel.layer.cornerRadius = moreLabel.frame.size.height/2;
        moreLabel.layer.borderColor = moreLabel.textColor.CGColor;
        moreLabel.layer.borderWidth = .5;
        
        UIImageView *imageV = [TomamaUI createImageView:CGRectMake(0, 85*screenW_6, self.frame.size.width, 87.5*screenW_6) backGroundImageV:@"Main_meili_image"];
        [self addSubview:imageV];
        
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(click:)];
        [self addGestureRecognizer:tap];
    }
    return self;
}

-(void)click:(UITapGestureRecognizer *)tap
{
    _complete(tap.view.tag);
}

@end
